<?php
/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Sample page.
 */

include("../classes/fckeditor/fckeditor.php") ;

include("../dados/inc.config.php");
$string_conn = "host=$servidorbanco user=$loginbanco password=$senhabanco dbname=$bancodedados";
$conexao = pg_connect($string_conn);


if ($_POST["num_indicador"] != ""){
	$sql = "update monitorasus.indicadores_manuais set notatecnica='" . $_POST["FCKeditor1"] . "' where $where and num_indicador=" . $_POST["num_indicador"];
	pg_query( $sql);
	echo "<script language='JavaScript'>window.close();</script>";  
	exit;
}
$indicador = $_GET["ind"];
$sql = "select cast(substring(cast(notatecnica as text),1,2500) as text) as textonota1, cast(substring(cast(notatecnica as text),2501,2500) as text) as textonota2 , cast(substring(cast(notatecnica as text),5001,2500) as text) as textonota3, cast(substring(cast(notatecnica as text),7501,2500) as text) as textonota4, cast(substring(cast(notatecnica as text),10001,2500) as text) as textonota5, * 
from monitorasus.indicadores_manuais where $where and num_indicador = " . $indicador;	
$resultado = pg_query( $sql);
while ($rs = pg_fetch_array($resultado)){
	$notatecnica1 = $rs["textonota1"];
	$notatecnica2 = $rs["textonota2"];
	$notatecnica3 = $rs["textonota3"];
	$notatecnica4 = $rs["textonota4"];
	$notatecnica5 = $rs["textonota5"];
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Editor</title>
<script type="text/javascript">

function FCKeditor_OnComplete( editorInstance )
{
	var oCombo = document.getElementById( 'cmbToolbars' ) ;
	oCombo.value = editorInstance.ToolbarSet.Name ;
	oCombo.style.visibility = '' ;
}

function ChangeToolbar( toolbarName )
{
	window.location.href = window.location.pathname + "?Toolbar=" + toolbarName ;
}

</script>
</head>
<form action="inc.editor.php" method="post">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>ATENÇÃO: Você precisa clicar no botão <img src="../telas/images/buttonsaveoffice.JPG" /> para salvar as Alterações!!!</b></font>
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $sBasePath = $_SERVER['PHP_SELF'] ;
// $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;


$oFCKeditor = new FCKeditor('FCKeditor1') ;
// $oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->BasePath = '../classes/fckeditor/' ;	// '/fckeditor/' is the default value.

$oFCKeditor->ToolbarSet = htmlspecialchars("Default");

$oFCKeditor->Value = stripslashes($notatecnica1).stripslashes($notatecnica2).stripslashes($notatecnica3).stripslashes($notatecnica4).stripslashes($notatecnica5);
$oFCKeditor->Create() ;
?>
<input type="hidden" name="num_indicador" value="<? echo $indicador ?>"/>
</form>

<body>
</body>
</html>
